package com.liujit.standard.basis.generator.action.config;

/**
 * 默认的代码生成的配置
 *
 * @author fengshuonan
 * @date 2017-10-28-下午8:27
 */
public class GeneratorConfig extends AbstractGeneratorConfig {

    private String tableName;

    private String bizChName;

    public GeneratorConfig setTableName(String tableName) {
        this.tableName = tableName;
        return this;
    }

    public GeneratorConfig setBizChName(String bizChName) {
        this.bizChName = bizChName;
        return this;
    }

    protected void dataSourceConfig() {
        dataSourceConfig.setDriverName("com.mysql.jdbc.Driver");
        dataSourceConfig.setUsername("root");
        dataSourceConfig.setPassword("123456");
        dataSourceConfig.setUrl(
                "jdbc:mysql://118.178.123.238:3306/bamboo_dev?characterEncoding=utf8&autoReconnect=true&useSSL=false");
    }

    protected void contextConfig() {
        contextConfig.setAuthor("LiuJun");
        contextConfig.setProjectPath("/Users/liujun/Documents/workspace/bamboo/bamboo-serve/bamboo-admin-api");
        contextConfig.setPackageName("com.liujit.standard.basis");
        contextConfig.setTableName(tableName);
        contextConfig.setBizChName(bizChName);
        // 生成器开关
        contextConfig.setControllerSwitch(false);
        contextConfig.setServiceSwitch(true);
        contextConfig.setMapperSwitch(true);
        contextConfig.setXmlSwitch(false);
        contextConfig.setModelSwitch(true);
        contextConfig.setQuerySwitch(false);
    }

    @Override
    protected void config() {
        dataSourceConfig();
        contextConfig();
    }
}
